package com.study.util;

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

import java.io.IOException;

/**
 * @author StevenHan
 */
public class HttpUtil {


        public static String sendGetRequest(String url) throws RuntimeException {
            OkHttpClient okHttpClient = new OkHttpClient();

            Request request = new Request.Builder().url(url).build();
            try (Response response = okHttpClient.newCall(request).execute()) {
                return response.body().string();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }

        }
}
